package master2;

/**
 * @author chenyw
 * @date 2022/9/27 19:15
 * h指数
 */
public class M275hIndex {
    public int hIndex(int[] citations) {
        int l = 0;
        int r = citations.length - 1;
        while (l <= r) {
            int mid = l + (r - l) / 2;
            if (citations[mid] >= citations.length - mid) {
                r = mid - 1;
            } else {
                l = mid + 1;
            }
        }
        return citations.length - l;
    }
}
